<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />









  <meta name="baidu-site-verification" content="Q7ugSRSO7V" />







  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="linux,pdf," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="简介PDFtk 是什么？我觉得官网的一句话解释得很好。  If PDF is electronic paper, then PDFtk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. PDFtk is a simple tool for doing everyd">
<meta name="keywords" content="linux,pdf">
<meta property="og:type" content="article">
<meta property="og:title" content="pdf处理">
<meta property="og:url" content="http://yoursite.com/linux/pdf处理/index.html">
<meta property="og:site_name" content="chimps">
<meta property="og:description" content="简介PDFtk 是什么？我觉得官网的一句话解释得很好。  If PDF is electronic paper, then PDFtk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. PDFtk is a simple tool for doing everyd">
<meta property="og:updated_time" content="2017-04-23T13:42:26.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="pdf处理">
<meta name="twitter:description" content="简介PDFtk 是什么？我觉得官网的一句话解释得很好。  If PDF is electronic paper, then PDFtk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. PDFtk is a simple tool for doing everyd">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":30},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/linux/pdf处理/"/>





  <title> pdf处理 | chimps </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?dcb994042608bdb310eff950ba755ff1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">chimps</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/linux/pdf处理/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="chimps">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chimps">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                pdf处理
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-23T21:42:26+08:00">
                2017-04-23
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/linux/" itemprop="url" rel="index">
                    <span itemprop="name">linux</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a class="cloud-tie-join-count" href="/linux/pdf处理/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count join-count" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h1><p>PDFtk 是什么？我觉得官网的一句话解释得很好。</p>
<blockquote>
<p>If PDF is electronic paper, then PDFtk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. PDFtk is a simple tool for doing everyday things with PDF documents.</p>
</blockquote>
<p>其官方网站为：<br><a href="http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit" target="_blank" rel="external">官网</a></p>
<p>PDFtk 目前分为三个版本：</p>
<ul>
<li>PDFtk Server：<br>命令行工具。支持 windows、Linux、Mac。</li>
<li>PDFtk Free：<br>图形界面基础免费版；仅限 windows 用户；功能仅限于 PDF 合并和分割；</li>
<li>PDFtk Pro：<br>图形界面专业收费版；仅限 windows 用户，可以对 PDF 文档进行合并、分割、旋转、加水印、加邮戳、加密。</li>
</ul>
<p>对于 Linux 用户，唯一的选择是免费的 PDFtk Server，其功能与收费 PDFtk Pro 完全相同，只是没有 GUI 而已。作者还是很厚道的。</p>
<p>Linux 的各个发行版的官方源中基本都有该软件，直接 apt-get 或者 yum 安装即可。</p>
<h1 id="功能"><a href="#功能" class="headerlink" title="功能"></a>功能</h1><p>合并 PDF；<br>分割 PDF 页面；<br>旋转 PDF 文档或页面；<br>PDF 解密；（不是破解）<br>PDF 加密；<br>用 X/FDF 填写 PDF 表格；<br>从 PDF 表格中生成 PDF Data Stencils；<br>加背景水印或前景印章；<br>报告 PDF Metrics，书签和元数据；<br>增加 / 更新 PDF 书签或元数据；<br>给 PDF 页面或文档加附件；<br>解压 PDF 附件；<br>分解 PDF 文档为多个单页；<br>解压缩和重压缩页面流；<br>修复受损的 PDF 文档；<br>这功能完全可以与 Adobe Acrobat 相媲美了，更重要的是 PDFtk 支持 Linux 且完全免费。（个人用户免费，若用于商业用途需付费）。</p>
<h1 id="用法示例"><a href="#用法示例" class="headerlink" title="用法示例"></a>用法示例</h1><p>具体选项看这里：</p>
<p><a href="http://www.pdflabs.com/docs/pdftk-man-page/" target="_blank" rel="external">具体选项</a></p>
<p>下面给出一些常见的例子。例子原文</p>
<p>扫描一本书，odd.pdf 为书的全部奇数页，even.pdf 为书的全部偶数页，下面的命令可以将两个 pdf 合并成页码正常的书:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk A=odd.pdf B=even.pdf shuffle A B output collated.pdf</div></pre></td></tr></table></figure></p>
<p>如果 odd.pdf 是逆序的:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk A=odd.pdf B=even.pdf shuffle Aend-1 B output collated.pdf</div></pre></td></tr></table></figure></p>
<p>加密 PDF:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk secured.pdf input_pw foopass output unsecured.pdf</div></pre></td></tr></table></figure></p>
<p>PDF 128 位加密，保留全部权限:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk 1.pdf output 1.128.pdf owner_pw foopass</div></pre></td></tr></table></figure></p>
<p>PDF 128 位加密，保留全部权限，打开文档需输入密码 “baz”:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz</div></pre></td></tr></table></figure></p>
<p>PDF 128 位加密，打开文档需输入密码 “baz”，保留打印之外的其他权限:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing</div></pre></td></tr></table></figure></p>
<p>合并 in1.pdf 和 in2.pdf 到新 PDF 中:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in1.pdf in2.pdf cat output out1.pdf</div></pre></td></tr></table></figure></p>
<p>或（使用句柄）:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf</div></pre></td></tr></table></figure></p>
<p>或（使用通配符）:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk *.pdf cat output combined.pdf</div></pre></td></tr></table></figure></p>
<p>去除 in1.pdf 中的第 13 页，并创建 out1.pdf:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf cat 1-12 14-end output out1.pdf</div></pre></td></tr></table></figure></p>
<p>或<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf</div></pre></td></tr></table></figure></p>
<p>对输出进行 40 位加密，撤销所有权限，设置 owner 密码为 foopass:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass</div></pre></td></tr></table></figure></p>
<p>合并两个文件，其中一个需要被加密。对输出不加密:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf</div></pre></td></tr></table></figure></p>
<p>解压 PDF 页面流，然后就可以在文本编辑器中编辑 PDF 文件:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk doc.pdf output doc.unc.pdf uncompress</div></pre></td></tr></table></figure></p>
<p>压缩 PDF:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk mydoc.pdf output mydoc.clear.pdf compress</div></pre></td></tr></table></figure></p>
<p>修复破损的 PDF:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk broken.pdf output fixed.pdf</div></pre></td></tr></table></figure></p>
<p>将一个 PDF 文档分割成一页一个文档:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf burst</div></pre></td></tr></table></figure></p>
<p>将一个 PDF 文档分割成一页一个文档，并加密，允许低质量的打印:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf burst owner_pw foopass allow DegradedPrinting</div></pre></td></tr></table></figure></p>
<p>获取 PDF 问的元数据和书签信息:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf dump_data output report.txt</div></pre></td></tr></table></figure></p>
<p>将 PDF 第一页顺时针旋转 90 度:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf cat 1east 2-end output out.pdf</div></pre></td></tr></table></figure></p>
<p>将整个 PDF 文档旋转 180 度:<br><figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">pdftk in.pdf cat 1-endsouth output out.pdf</div></pre></td></tr></table></figure></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/linux/" rel="tag"># linux</a>
          
            <a href="/tags/pdf/" rel="tag"># pdf</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/linux/shell/" rel="next" title="shell">
                <i class="fa fa-chevron-left"></i> shell
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/golang/正则表达式/" rel="prev" title="正则表达式">
                正则表达式 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256"
               alt="chimps" />
          <p class="site-author-name" itemprop="name">chimps</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">59</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">19</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#简介"><span class="nav-number">1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#功能"><span class="nav-number">2.</span> <span class="nav-text">功能</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#用法示例"><span class="nav-number">3.</span> <span class="nav-text">用法示例</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">chimps</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  
    
    <script>
      var cloudTieConfig = {
        url: document.location.href, 
        sourceId: "",
        productKey: "48bb30d8783d4b38ba0c95e0283238ca",
        target: "cloud-tie-wrapper"
      };
    </script>
    <script src="https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"></script>
  










  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

</body>
</html>
